package com.darly.widget.charting.charts;

import android.content.Context;
import android.util.AttributeSet;

import androidx.annotation.StringDef;

import com.darly.widget.charting.data.ScatterData;
import com.darly.widget.charting.interfaces.dataprovider.ScatterDataProvider;
import com.darly.widget.charting.renderer.ScatterChartRenderer;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * The ScatterChart. Draws dots, triangles, squares and custom shapes into the
 * Chart-View. CIRCLE and SCQUARE offer the best performance, TRIANGLE has the
 * worst performance.
 *
 * @author Philipp Jahoda
 */
public class ScatterChart extends BarLineChartBase<ScatterData> implements ScatterDataProvider {

    public ScatterChart(Context context) {
        super(context);
    }

    public ScatterChart(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ScatterChart(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }


    @Override
    protected void init() {
        super.init();

        mRenderer = new ScatterChartRenderer(this, mAnimator, mViewPortHandler);

        getXAxis().setSpaceMin(0.5f);
        getXAxis().setSpaceMax(0.5f);
    }

    @Override
    public ScatterData getScatterData() {
        return mData;
    }

    /**
     * Predefined ScatterShapes that allow the specification of a shape a ScatterDataSet should be drawn with.
     * If a ScatterShape is specified for a ScatterDataSet, the required renderer is set.
     */
    public static final String SQUARE = "SQUARE";
    public static final String CIRCLE = "CIRCLE";
    public static final String TRIANGLE = "TRIANGLE";
    public static final String CROSS = "CROSS";
    public static final String X = "X";
    public static final String CHEVRON_UP = "CHEVRON_UP";
    public static final String CHEVRON_DOWN = "CHEVRON_DOWN";
    @StringDef(value = {
            SQUARE,
            CIRCLE,
            TRIANGLE,
            CROSS,
            X,
            CHEVRON_UP,
            CHEVRON_DOWN,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface ScatterShape {}
}
